package com.lineage.server.serverpackets;

public class S_RedMessage extends ServerBasePacket {
  private static final String _S__18_REDMESSAGE = "[S] S_RedMessage";
  
  private byte[] _byte;
  
  public S_RedMessage(int type, String msg1) {
    this._byte = null;
    buildPacket(type, msg1, (String)null, (String)null, 1);
  }
  
  public S_RedMessage(int type, String msg1, String msg2) {
    this._byte = null;
    buildPacket(type, msg1, msg2, (String)null, 2);
  }
  
  public S_RedMessage(int type, String msg1, String msg2, String msg3) {
    this._byte = null;
    buildPacket(type, msg1, msg2, msg3, 3);
  }
  
  private void buildPacket(int type, String msg1, String msg2, String msg3, int check) {
    writeC(105);
    writeH(type);
    if (check == 1) {
      if (msg1.length() <= 0) {
        writeC(0);
      } else {
        writeC(1);
        writeS(msg1);
      } 
    } else if (check == 2) {
      writeC(2);
      writeS(msg1);
      writeS(msg2);
    } else if (check == 3) {
      writeC(3);
      writeS(msg1);
      writeS(msg2);
      writeS(msg3);
    } 
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = this._bao.toByteArray(); 
    return this._byte;
  }
  
  public String getType() {
    return "[S] S_RedMessage";
  }
}
